<html>
<head>
  <title>Portus error page</title>
  <%= stylesheet_link_tag 'application', media: 'all' %>
  <%= javascript_include_tag 'application'%>
  <%= csrf_meta_tags %>
</head>
<body class="login">
  <div class="container-fluid">
    <div class="row-0">
      <div class="center-panel">
        <div class="col-md-4 col-sm-2 col-xs-1"></div>
        <div class="col-md-4 col-sm-8 col-xs-10">
          <div class="oops">
            <%= image_tag "layout/portus-error.png", class: "broken-lighthouse" %>
            <h1><strong>Oh no!</strong></h1>
            <h3>something's wrong with our lighthouse.</h3>
          </div>
        </div>
        <div class="clearfix"></div>
      </div>
      <div class="row-0">
        <div class="col-sm-8 col-sm-offset-2 error-fixes">
          <% if @fix.value?(true) %>
            <h1>Please review your configuration</h1>
            <div style="margin: 100px">
              <% if @fix[:ssl] %>
                <h2>SSL</h2>
                <p>For security reasons you need to use SSL. SSL is not configured, please review your server configuration.</p>
              <% end %>
              <% if @fix[:secret_key_base] %>
                <h2>Fix secret key base</h2>
                <p>For security reasons you need to set a <i>secret_key_base</i>. You have a default value and this is not safe. Run:</p>
                <p><i> rake secret</i></p>
                to generate a new secret, and then
                <% if Rails.env.production? %>
                  set <i>PORTUS_SECRET_KEY_BASE</i> environment variable to this value.
                <% else %>
                  set <i>secret_key_base</i> to this value in <i>config/secret.yml</i>.
                <% end %>
                </p>
              <% end %>
              <% if @fix[:secret_machine_fqdn] %>
                <h2>Fix secret machine fqdn value</h2>
                You need to set the machine fdqn value for Portus to work. In order to do this, you have to set the <i>machine_fqdn</i> value in <i>config/config-local.yml</i>.
              <% end %>
              <% if @fix[:secret_encryption_private_key_path] %>
                <h2>Fix secret encryption private key path value</h2>
                You need to set the secret encryption private key path value for Portus to work.
                <% if Rails.env.production? %>
                  Set <i>PORTUS_KEY_PATH</i> environment variable.
                <% else %>
                  Set <i>encryption_private_key_path</i> in <i>config/secrets.yml</i>.
                <% end %>
              <% end %>
              <% if @fix[:secret_portus_password] %>
                <h2>Fix secret portus password</h2>
                You need to set the secret encryption private key path value for Portus to work.
                <% if Rails.env.production? %>
                  Set <i>PORTUS_PASSWORD</i> environment variable.
                <% else %>
                  Set <i>portus_password</i> in <i>config/secrets.yml</i>.
                <% end %>
              <% end %>
              <% if @fix[:database] %>
                <h2>Database</h2>
                <p>We cannot access the database.
                <% if Rails.env.production? %>
                  Please set the following environment variables:
                  <ul>
                    <li>PORTUS_PRODUCTION_USERNAME</li>
                    <li>PORTUS_PRODUCTION_PASSWORD</li>
                    <li>PORTUS_PRODUCTION_HOST</li>
                    <li>PORTUS_PRODUCTION_DATABASE</li>
                  </ul>
                <% else %>
                  Please review <i>config/database.yml</i> file.
                <% end %>

              <% end %>
            </div>
          <% else %>
            <p>
              <i class="fa fa-exclamation-circle"></i>
            If you are the application owner check the logs for more information.
            </p>
          <% end %>
        </div>
      </div>
    </div>
  </div>
</body>
</html>

